"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//对象
var foo = function () { };
var obj = { foo: 1 };
//数组
var arr1 = [1, 2];
var arr2 = [2, 3];
function sum() {
    var args = [];
    for (var _i = 0; _i < arguments.length; _i++) {
        args[_i] = arguments[_i];
    }
    return args.reduce(function (perv, crrrent) { return perv + crrrent; }, 0);
}
// sum(1,2,'foo')会报错
//元组
var tuple = [17, 'caozy'];
var age = tuple[0], name = tuple[1];
//枚举类型 
// 数字自增长
// enum postStatus{
//     d=0,
//     u,
//     p
// }
var postStatus;
(function (postStatus) {
    postStatus["d"] = "a";
    postStatus["u"] = "b";
    postStatus["p"] = "c";
})(postStatus || (postStatus = {}));
var post = {
    title: 'hello',
    text: 'ts is atyped superset of js',
    status: postStatus.d
};
//函数类型
//?表示可选参数 可选参数必须在最后面
function fn(a, b) {
    var rest = [];
    for (var _i = 2; _i < arguments.length; _i++) {
        rest[_i - 2] = arguments[_i];
    }
    return 'foo';
}
var fns = fn;
//任意类型
var anys = [];
//隐式类型推断
var ages = 18;
//  ages='ages' 会报错
var foos; //这时候表示是一个any类型的变量
//类型断言
var nums = [1, 2, 3, 4];
var res = nums.find(function (i) { return i > 0; });
var s = res * res;
